package 状态机.请假demo.machine;


import com.google.common.eventbus.EventBus;
import 状态机.请假demo.entity.LeavePermit;

/**
 * 如何在状态改变时触发A状态转换到B状态的过程，借助 EventBus 这个工具，
 * 让 A 状态的转移处理者订阅相关的 Handler？？？？
 *
 */
public class StatusMachineEngine {

    private static EventBus eventBus;
    static{
        eventBus = new EventBus();
    }

    /**
     * 发布一条假单
     * @param leavePermit
     */
    public static void post(LeavePermit leavePermit) {
        eventBus.post(leavePermit);
    }

    /**
     * 假单处理类
     * @param statusNotifySpecificLeavePermitHandler
     */
    public static void addListener(NotifySpecificLeavePermitHandler statusNotifySpecificLeavePermitHandler) {
        eventBus.register(statusNotifySpecificLeavePermitHandler);
    }
}


